using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Pixysoft.IO
{
    public class ObjectCloner
    {
        public static object Clone(object value)
        {
            lock (typeof(ObjectCloner))
            {
                if (value == null)
                    return null;
                return XmlImporter.Instance.XmlDeserialize(XmlExporter.Instance.XmlSerialize(value), value.GetType());
            }
        }

        public static T CloneNew<T>()
        {
            return (T)Activator.CreateInstance(typeof(T));
        }
    }
}
